<!DOCTYPE html>
<html lang="">

<head>
	<meta name="generator" content="Hugo 0.73.0" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="author" content="Ap Chen ">
<meta name="description" content="事务 事务：由某个用户执行的一个不能够被打断的对数据库的操作序列 影响因素 concurrency 并发控制 abort crash 故障恢复 事务的四个性质：ACID Atomicity：要么" />
<meta name="keywords" content="blog" />
<meta name="robots" content="noodp" />

<link rel="canonical" href="https://fziks.gitee.io/notes/database/6-%E4%BA%8B%E5%8A%A1%E5%A4%84%E7%90%86/" />

<meta itemprop="name" content="6-事务处理">
<meta itemprop="description" content="事务 事务：由某个用户执行的一个不能够被打断的对数据库的操作序列 影响因素 concurrency 并发控制 abort crash 故障恢复 事务的四个性质：ACID Atomicity：要么">
<meta itemprop="datePublished" content="2019-05-26T00:00:00&#43;00:00" />
<meta itemprop="dateModified" content="2019-05-26T00:00:00&#43;00:00" />
<meta itemprop="wordCount" content="1765">



<meta itemprop="keywords" content="" />
<meta property="og:title" content="6-事务处理" />
<meta property="og:description" content="事务 事务：由某个用户执行的一个不能够被打断的对数据库的操作序列 影响因素 concurrency 并发控制 abort crash 故障恢复 事务的四个性质：ACID Atomicity：要么" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://fziks.gitee.io/notes/database/6-%E4%BA%8B%E5%8A%A1%E5%A4%84%E7%90%86/" />
<meta property="article:published_time" content="2019-05-26T00:00:00+00:00" />
<meta property="article:modified_time" content="2019-05-26T00:00:00+00:00" />

<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="6-事务处理"/>
<meta name="twitter:description" content="事务 事务：由某个用户执行的一个不能够被打断的对数据库的操作序列 影响因素 concurrency 并发控制 abort crash 故障恢复 事务的四个性质：ACID Atomicity：要么"/>


<link rel="apple-touch-icon" sizes="60x60" href="https://fziks.gitee.io/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="https://fziks.gitee.io/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="https://fziks.gitee.io/icons/favicon-16x16.png">
<link rel="manifest" href="https://fziks.gitee.io/icons/site.webmanifest">
<link rel="mask-icon" href="https://fziks.gitee.io/icons/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="https://fziks.gitee.io/icons/favicon.ico">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-config" content="/icons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">

<title>6-事务处理</title>


<link rel="stylesheet" href="//at.alicdn.com/t/font_1559566_wk214kwa2dn.css">


    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">



    
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.css" integrity="sha256-WAgYcAck1C1/zEl5sBl5cfyhxtLgKGdpI3oKyJffVRI=" crossorigin="anonymous" />
    
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.css" integrity="sha256-a2tobsqlbgLsWs7ZVUGgP5IvWZsx8bTNQpzsqCSm5mk=" crossorigin="anonymous" />
    
   <link href="https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/materia/bootstrap.min.css" rel="stylesheet" integrity="sha384-1tymk6x9Y5K+OF0tlmG2fDRcn67QGzBkiM3IgtJ3VrtGrIi5ryhHjKjeeS60f1FA" crossorigin="anonymous">
    
    
    <link rel="stylesheet" href="https://fziks.gitee.io/sass/main_cdn.min.270b43bb8631af4497ed45b90db42c517e86c9511418de9152f134d02ed32b87.min.2192baea245cf318085511589e62bfbdb3fbe4fb0eef718f1be9af91c10542ce.css" integity="sha256-IZK66iRc8xgIVRFYnmK/vbP75PsO73GPG&#43;mvkcEFQs4=">

</head>

<body style="overflow-x: unset;">
	<div class="container-fluid">
		<div class="row d-print-block">
			<div class="col-12 col-md-3 col-lg-2 bd-sidebar d-print-none">
				<div class="d-flex mt-3 border-bottom">
        <span class="navbar-brand w-100" style="display: grid;">
            <small>
                <a href="https://fziks.gitee.io/" class="text-black-50">
                    <i class="iconfont icon-back-arrow-"></i>
                </a>
                Ap Chen's
            </small>
            <a class="text-dark" href="https://fziks.gitee.io/notes/">
                Notes
            </a>
        </span>
        <button class="btn btn-link text-dark d-md-none p-0 ml-3" type="button" data-toggle="collapse"
            data-target="#bd-docs-nav" aria-controls="bd-docs-nav" aria-expanded="true"
            aria-label="Toggle docs navigation">
            <i class="fad fa-bars"></i>
        </button>
    </div>
				<nav id="bd-docs-nav" class="collapse bd-links">
    
    
    
    <div class="bd-toc-item">
        <a class="bd-toc-link" href="https://fziks.gitee.io/notes/computer-network/">
            
            
                <span class="icontext">S</span>
            
            
            计算机网络
        </a>
    </div>
    
    
    
    <div class="bd-toc-item">
        <a class="bd-toc-link" href="https://fziks.gitee.io/notes/operating-system/">
            
            
                <span class="icontext">S</span>
            
            
            操作系统
        </a>
    </div>
    
    
    
    <div class="bd-toc-item active bg-light">
        <a class="bd-toc-link" href="https://fziks.gitee.io/notes/database/">
            <i class="iconfont icon-back-arrow-reverse"></i>
            数据库
        </a>
        <ul class="nav bd-sidenav">
            
            
            <li>
                <a href="https://fziks.gitee.io/notes/database/1-%E6%A6%82%E8%BF%B0/">1-概述</a>
            </li>
            
            
            
            <li>
                <a href="https://fziks.gitee.io/notes/database/2-%E6%95%B0%E6%8D%AE%E6%A8%A1%E5%9E%8B/">2-数据模型</a>
            </li>
            
            
            
            <li>
                <a href="https://fziks.gitee.io/notes/database/3-%E5%85%B3%E7%B3%BB%E6%95%B0%E6%8D%AE%E5%BA%93%E7%B3%BB%E7%BB%9F/">3-关系数据库系统</a>
            </li>
            
            
            
            <li>
                <a href="https://fziks.gitee.io/notes/database/8-%E8%A7%84%E8%8C%83%E5%8C%96%E7%90%86%E8%AE%BA/">8-规范化理论</a>
            </li>
            
            
            
            <li>
                <a href="https://fziks.gitee.io/notes/database/5-%E5%AE%89%E5%85%A8%E6%80%A7%E4%B8%8E%E5%AE%8C%E6%95%B4%E6%80%A7/">5-安全性与完整性</a>
            </li>
            
            
            
            <li class="active">
                <a href="https://fziks.gitee.io/notes/database/6-%E4%BA%8B%E5%8A%A1%E5%A4%84%E7%90%86/">
                    <i class="fad fa-chevron-right mr-1"></i>
                    6-事务处理
                </a>
            </li>
            
            
            
            <li>
                <a href="https://fziks.gitee.io/notes/database/7-%E6%95%B0%E6%8D%AE%E5%BA%93%E7%9A%84%E7%89%A9%E7%90%86%E7%BB%84%E7%BB%87/">7-数据库的物理组织</a>
            </li>
            
            
            
            <li>
                <a href="https://fziks.gitee.io/notes/database/8-%E6%95%B0%E6%8D%AE%E4%BA%A4%E6%8D%A2/">8-数据交换</a>
            </li>
            
            
            
            <li>
                <a href="https://fziks.gitee.io/notes/database/9-%E6%95%B0%E6%8D%AE%E5%BA%93%E8%AE%BE%E8%AE%A1/">9-数据库设计</a>
            </li>
            
            
        </ul>
    </div>
    
    
    
    <div class="bd-toc-item">
        <a class="bd-toc-link" href="https://fziks.gitee.io/notes/cs50-introduction-to-computer-science/">
            
            
                <span class="icontext">S</span>
            
            
            CS50 MIT
        </a>
    </div>
    
    
    
    <div class="bd-toc-item">
        <a class="bd-toc-link" href="https://fziks.gitee.io/notes/advanced-programming/">
            
            
                <span class="icontext">A</span>
            
            
            高级程序设计
        </a>
    </div>
    
    
    
    <div class="bd-toc-item">
        <a class="bd-toc-link" href="https://fziks.gitee.io/notes/deep-learning/">
            
            
                <span class="icontext">O</span>
            
            
            深度学习基础
        </a>
    </div>
    
    
    
    <div class="bd-toc-item">
        <a class="bd-toc-link" href="https://fziks.gitee.io/notes/%E6%96%87%E7%8C%AE%E7%AE%A1%E7%90%86%E4%B8%8E%E4%BF%A1%E6%81%AF%E5%88%86%E6%9E%90/">
            
            
                <span class="icontext">O</span>
            
            
            文献管理与信息分析
        </a>
    </div>
    
    
</nav>
			</div>
			<div class="col-12 col-md-9 col-lg-10 d-print-block">
				<div class="row d-print-block">
					<main class="col-12 col-md-10 col-lg-9 py-md-3 pl-md-5 bd-content d-print-block" role="main">
						<div id="title" class="my-4 border-bottom">
							<span>数据库</span>
							<h2>6-事务处理</h2>
							<footer>
								<span>
									<i class="iconfont icon-NewFile mr-2"></i>
									2019-05-26 08:00 CST
								</span> <br />
								<span>
									<i class="iconfont icon-modify mr-2"></i>
									2019-05-26 08:00 CST
								</span> <br />
								<span>
									<i class="iconfont icon-copyright mr-2"></i>
									CC BY-NC 4.0
								</span>
							</footer>
						</div>
						<div id="content" class="hl-h2">
							
							
							
							
							
							
							
							
							
							
							
							
							<h2 id="事务">事务<a href="#事务" class="anchor" aria-hidden="true"><i class="iconfont icon-link"></i></a></h2>
<ul>
<li>事务：由某个用户执行的一个不能够被打断的对数据库的操作序列</li>
<li>影响因素
<ul>
<li>concurrency 并发控制</li>
<li>abort</li>
<li>crash 故障恢复</li>
</ul>
</li>
<li>事务的四个性质：ACID
<ul>
<li>Atomicity：要么全部发生，要么都不发生</li>
<li>Consistency：满足数据约束</li>
<li>Isolation：并发事务的可串行化</li>
<li>Durability：数据不丢失</li>
</ul>
</li>
</ul>
<p><img src="https://fziks.gitee.io/images/content/DB-transaction.png" alt="事务活动图"></p>
<h3 id="事务控制">事务控制<a href="#事务控制" class="anchor" aria-hidden="true"><i class="iconfont icon-link"></i></a></h3>
<ul>
<li>
<p>事务控制语句</p>
<ul>
<li>
<p>begin transaction</p>
<p>数据定义命令(DDL)：每条数据定义命令为一个单独的事务</p>
<p>自动提交方式(<code>set autocommit on|off</code>)：每条访问命令为单独的事务</p>
<p>数据操纵命令(DML)</p>
</li>
<li>
<p>commit transaction</p>
</li>
<li>
<p>rollback transaction</p>
<p>savepoint</p>
</li>
</ul>
</li>
<li>
<p>事务控制命令(DCL)</p>
<ul>
<li><code>set autocommit on|off</code></li>
<li><code>set transaction readonly|readwrite</code></li>
<li><code>set transaction isolation level readuncomitted|readcomitted|readrepeatable|serializable</code></li>
</ul>
</li>
<li>
<p>并发错误</p>
<ul>
<li>更新丢失：对多个事务并发修改同一个数据对象的情况未加控制</li>
<li>脏读：一个事务读取到了另外一个事务没有提交的数据</li>
<li>不可重复读：在两次连续的读操作间插入了另一个事务的写操作</li>
<li>幻象读：在两次连续的查询操作间插入了另一个事务的插入操作</li>
</ul>
</li>
</ul>
<table>
<thead>
<tr>
<th>隔离级别</th>
<th>Dirty Read</th>
<th>Non-repeatable Read</th>
<th>Phantom Read</th>
</tr>
</thead>
<tbody>
<tr>
<td>Read uncommited</td>
<td>Possible</td>
<td>Possible</td>
<td>Possible</td>
</tr>
<tr>
<td>Read commited</td>
<td></td>
<td>Possible</td>
<td>Possible</td>
</tr>
<tr>
<td>Repeatable read</td>
<td></td>
<td></td>
<td>Possible</td>
</tr>
<tr>
<td>Serializable</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="事务的语句组成">事务的语句组成<a href="#事务的语句组成" class="anchor" aria-hidden="true"><i class="iconfont icon-link"></i></a></h3>
<ul>
<li>事务控制操纵
<ul>
<li>事务开始：START T0</li>
<li>提交事务：COMMIT T0</li>
<li>回退事务：ABORT T0</li>
</ul>
</li>
<li>数据访问操纵
<ul>
<li>INPUT(A)</li>
<li>OUTPUT(A)</li>
<li>READ(A,t)</li>
<li>WRITE(A,t)</li>
</ul>
</li>
</ul>
<h2 id="并发控制">并发控制<a href="#并发控制" class="anchor" aria-hidden="true"><i class="iconfont icon-link"></i></a></h2>
<p>实现并发事务的可串行化调度</p>
<h3 id="调度定义">调度定义<a href="#调度定义" class="anchor" aria-hidden="true"><i class="iconfont icon-link"></i></a></h3>
<ul>
<li>串行执行：多个事务依次执行</li>
<li>并发执行：交替执行来自不同事务的操作</li>
<li>调度（Schedule, History）：DBMS 中实际执行序列</li>
<li>可串行化调度：对数据库状态的影响和某个串行调度相同</li>
<li>事务与调度表示方法
<ul>
<li>事务： $T_i$</li>
<li>事务 $T_i$ 读写数据库对象 $X$：$r_i(X)$</li>
</ul>
</li>
<li>冲突：一对相邻操作，交换顺序改变结果
<ul>
<li>同一事务相同操作是冲突</li>
<li>不同事务对同一数据对象的读-写冲突</li>
<li>不同事务对同一对象的写冲突</li>
</ul>
</li>
<li>冲突可串行化调度：通过非冲突操作交换可变为串行调度
<ul>
<li>充分条件</li>
<li>冲突等价</li>
<li>优先图无环</li>
</ul>
</li>
<li>视图等价：对每个数据项
<ul>
<li>一方能读到初始值，另一方也能读到初始值</li>
<li>如果在调度S中事务Tk执行了rk(D)，并且读到的是由事务Tj写入的D的值，则在调度H中事务Tk的rk(D)读到的也必须是由事务Tj所写入的D的值</li>
<li>如果在调度S中是由事务Tk来执行最后一条关于D的写操作wk(D)，则在调度H中也一定是事务Tk执行最后一条关于D的写操作wk(D)</li>
<li>视图等价是冲突等价的必要非充分条件</li>
</ul>
</li>
</ul>
<h3 id="锁">锁<a href="#锁" class="anchor" aria-hidden="true"><i class="iconfont icon-link"></i></a></h3>
<ul>
<li>锁
<ul>
<li>排它锁(X-lock)</li>
<li>共享锁(S-lock)</li>
</ul>
</li>
<li>锁协议
<ul>
<li>一级锁协议：写前必须申请X锁并维持到事务执行结束（丢失修改）</li>
<li>二级锁协议：一级+读之前申请S锁并维持到读操作完成后（丢失修改，脏读）</li>
<li>三级锁协议：一级+读之前申请S锁并维持到事务执行结束（丢失修改，脏读，不可重复读）</li>
<li>两阶段锁协议(2PL)
<ul>
<li>申请并获得锁</li>
<li>释放所有申请的锁</li>
<li>两阶段锁事务：所有锁请求先于解锁请求</li>
<li>由2PL事务所构成的任意合法调度S都是冲突可串行化的</li>
</ul>
</li>
</ul>
</li>
<li>锁粒度：一把锁可以封锁的数据对象大小
<ul>
<li>锁粒度大，系统并发度低，并发控制开销小</li>
<li>多粒度封锁：同时支持多种封锁粒度
<ul>
<li>多粒度树</li>
</ul>
</li>
</ul>
</li>
<li>意向锁
<ul>
<li>意向共享锁(IS锁)</li>
<li>意向排它锁(IX锁)</li>
<li>共享意向排它锁(SIX锁)</li>
</ul>
</li>
<li>意向锁加锁算法
<ul>
<li>如果对一个结点加‘意向锁’，则说明该结点的下层结点正在被加锁</li>
<li>对任一结点加锁时，必须先对它的上层结点加‘意向锁’</li>
<li>申请封锁：自上而下</li>
<li>释放封锁：自下而上</li>
</ul>
</li>
<li>锁相容矩阵</li>
</ul>
<p><img src="https://fziks.gitee.io/images/content/lock.png" alt="锁相容矩阵"></p>
<ul>
<li>死锁：循环等待现象
<ul>
<li>预防法
<ul>
<li>顺序申请法</li>
<li>一次申请法</li>
</ul>
</li>
<li>解除法
<ul>
<li>超时死锁算法
<ul>
<li>事务执行超时</li>
<li>锁申请超时</li>
</ul>
</li>
<li>等待图法</li>
<li>时间戳死锁检测法
<ul>
<li>等待-死亡方案</li>
<li>伤害-等待方案</li>
<li>牺牲年轻事务</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>活锁：部分事务因封锁申请无法满足长期等待
<ul>
<li>先来先服务</li>
</ul>
</li>
</ul>
<h2 id="数据库恢复">数据库恢复<a href="#数据库恢复" class="anchor" aria-hidden="true"><i class="iconfont icon-link"></i></a></h2>
<p>数据库遭到破坏后及时恢复的功能</p>
<ul>
<li>故障分类
<ul>
<li>小型故障
<ul>
<li>事务内故障</li>
</ul>
</li>
<li>中型故障
<ul>
<li>系统故障</li>
<li>外部影响</li>
</ul>
</li>
<li>大型故障
<ul>
<li>磁盘故障</li>
<li>计算机病毒</li>
<li>黑客入侵</li>
</ul>
</li>
</ul>
</li>
<li>数据转储(dump)：定期将数据库内容复制到其它储存设备
<ul>
<li>静态转储/动态转储</li>
<li>海量转储/增量转储</li>
<li>结合数据库日志：转储的开始与结束点，事务更新操作</li>
</ul>
</li>
<li>数据库镜像</li>
<li>日志：自动记载修改型操作的数据更新情况文件
<ul>
<li>undo日志：用于被放弃事务的撤销工作
<ul>
<li>记录格式
<ul>
<li>开始：Start T</li>
<li>提交：Commit T（须在事务所有操作写入磁盘后写入）</li>
<li>放弃：Abort T</li>
<li>更新：T,X,V (V是原来的值，须在新值写入磁盘前写入)</li>
<li>Flush Log: 内存中的日志记录写到磁盘</li>
</ul>
</li>
<li>恢复过程：从尾部开始扫描整个日志，对未提交事务恢复数值，加入 Abort T</li>
</ul>
</li>
<li>检查点
<ul>
<li>处理过程
<ul>
<li>系统停止接受 Start T</li>
<li>等待当前活跃事务被提交或中止</li>
<li>写入所有日志</li>
<li>写入 CKPT</li>
</ul>
</li>
<li>非静止检查点</li>
</ul>
</li>
<li>redo日志：用于已提交事务的重做工作
<ul>
<li>V是更新的值</li>
<li>Commit 写入后修改</li>
<li>冗余修改</li>
</ul>
</li>
<li>undo/redo日志
<ul>
<li>T,X,v,w</li>
<li>事务提交和写数据库磁盘的顺序是随机的</li>
<li>故障恢复
<ul>
<li>undo 未提交事务</li>
<li>redo 已提交事务</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>

						</div>
					</main>
					<div class="d-none d-lg-block col-lg-3 bd-toc d-print-none">
						<div class="btn-group-vertical w-100 my-3">
    
    <a class="btn btn-outline-secondary text-dark w-100 p-2" href="https://list.html" target="_blank">
        <i class="iconfont icon-LC_icon_list_line"></i><br />待更新列表
    </a>
    

    
    <a class="btn btn-outline-secondary text-dark w-100 p-2" href="mailto:littlegreedy@qq.com"
        target="_blank">
        <i class="iconfont icon-discussion"></i><br />纠错与咨询
    </a>
    
    
    
    
        <a class="btn btn-outline-secondary text-dark w-100 p-2" href="#" onclick="window.print()">
            <i class="iconfont icon-dayin"></i><br />打印本页
        </a>
    
    
</div>
						<h4 class="card-title pb-0">目录</h4>
						<nav id="TableOfContents">
  <ul>
    <li><a href="#事务">事务</a>
      <ul>
        <li><a href="#事务控制">事务控制</a></li>
        <li><a href="#事务的语句组成">事务的语句组成</a></li>
      </ul>
    </li>
    <li><a href="#并发控制">并发控制</a>
      <ul>
        <li><a href="#调度定义">调度定义</a></li>
        <li><a href="#锁">锁</a></li>
      </ul>
    </li>
    <li><a href="#数据库恢复">数据库恢复</a></li>
  </ul>
</nav>
						
						
						<div id="disqus_thread"></div>
							<script>
							

							

							(function() { 
							var d = document, s = d.createElement('script');
							s.src = "https://"+"your site name on disqus"+".disqus.com/embed.js";
							s.setAttribute('data-timestamp', +new Date());
							(d.head || d.body).appendChild(s);
							})();
							</script>
							<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>                  
					  	</div>
						
					</div>
				</div>
			</div>
		</div>
	</div>

	<script
    src="https://code.jquery.com/jquery-3.4.1.min.js"
    integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
    crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script><script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>

<script type="text/javascript" src="https://fziks.gitee.io/custom.min.d3e1b7647f32dbe7e0140398739a26dad3f3470fc1eebe0741ef33668f1b7bd0b2917dc6efb9f0d9f1092b91dca502cab1b883863f02530133a8a8ef609926af.js" integrity="sha512-0&#43;G3ZH8y2&#43;fgFAOYc5om2tPzRw/B7r4HQe8zZo8be9CykX3G77nw2fEJK5HcpQLKsbiDhj8CUwEzqKjvYJkmrw=="></script>
<script type="text/javascript">

document.addEventListener("DOMContentLoaded", function () {
    renderMathInElement(
        document.body, {
            delimiters: [
                {
                    left: "$$",
                    right: "$$",
                    display: true
                },
                {
                    left: "\\[",
                    right: "\\]",
                    display: true
                },
                {
                    left: "$",
                    right: "$",
                    display: false
                },
                {
                    left: "\\(",
                    right: "\\)",
                    display: false
                }
            ],
            strict: false
        }
    );
});


$(document).on('click', 'a[href^="#"]', function (event) {
    event.preventDefault();

    $('html, body').animate({
        scrollTop: $($.attr(this, 'href')).offset().top
    }, 500);
});
</script>




</body>

</html>